class Solution {
public:
    int hammingDistance(int x, int y) {
        int ans = x ^ y;
        int ret = 0;
        while (ans) {
            ret++;
            ans &= ans - 1;
        }
        return ret;
    }
};